﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TreeAndGrid.aspx.cs" Inherits="JWBSTAPP.TreeAndGridDemo.TreeAndGrid" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>管理</title>
    <script src="../Scripts/jQuery-1.9.0.js" type="text/javascript"></script>
    <script src="../Scripts/CommonADEQ3.js" type="text/javascript"></script>
    <link href="../Styles/thickbox.css" type="text/css" rel="Stylesheet" />
    <link href="../Styles/Management.css" type="text/css" rel="Stylesheet" />
    <link href="../Styles/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/zTree/jquery.ztree.core-3.5.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var roleid = request("roleid");
        $().ready(function () {

            var setting = {
                async: {
                    enable: true,
                    url: "../AjaxServer/Application/AppResouRceHandler.ashx",
                    autoParam: ["id", "name=n", "level=lv"],
                    otherParam: { "action": "GetOrganizationTree" },
                    dataFilter: filter
                },
                check: {
                    enable: false
                },
                data: {
                    simpleData: {
                        enable: true
                    }
                },
                callback: {
                    onClick: zTreeOnClick

                }
            };

            function filter(treeId, parentNode, childNodes) {
                if (!childNodes) return null;
                for (var i = 0, l = childNodes.length; i < l; i++) {
                    childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
                }
                return childNodes;
            }
            $.fn.zTree.init($("#treeDemo"), setting);
            var queryBuilder;
            var ashxParam = { url: "../AjaxServer/Application/AppOrganizatiOnHandler.ashx", pageSize: "15" };
            var addPage = { title: "新增信息", url: "AppOrganizatiOnAdd.aspx", width: "800", height: "400" };
            var editPage = { title: "修改信息", url: "AppOrganizatiOnEdit.aspx", width: "800", height: "400" };
            var detailPage = { title: "详细信息", url: "AppOrganizatiOnDetail.aspx", width: "800", height: "400" };
            var columnInfo = [{ "columnName": "ORGNA_CODE", "columnText": "机构编码", "width": "100px" }, { "columnName": "ORGNA_NAME", "columnText": "机构名称", "width": "200px", "style": "text-align:left" }, { "columnName": "ORGNA_TYPE", "columnText": "机构类型" }, { "columnName": "ORGNA_ADDRESS", "columnText": "机构地址" }, { "columnName": "ORGNA_TEL", "columnText": "联系电话"}];
            queryBuilder = [{ "name": "id", "value": "1"}];
            initNewGrid(queryBuilder, ashxParam, columnInfo, addPage, editPage, detailPage);
        });

        function zTreeOnClick(e, treeId, treeNode) {
            if (treeNode.id) {
                var queryBuilder;
                var ashxParam = { url: "../AjaxServer/Application/AppOrganizatiOnHandler.ashx", pageSize: "15" };
                var addPage = { title: "新增信息", url: "AppOrganizatiOnAdd.aspx", width: "800", height: "400" };
                var editPage = { title: "修改信息", url: "AppOrganizatiOnEdit.aspx", width: "800", height: "400" };
                var detailPage = { title: "详细信息", url: "AppOrganizatiOnDetail.aspx", width: "800", height: "400" };
                var columnInfo = [{ "columnName": "ORGNA_CODE", "columnText": "机构编码", "width": "100px" }, { "columnName": "ORGNA_NAME", "columnText": "机构名称", "width": "200px", "style": "text-align:left" }, { "columnName": "ORGNA_TYPE", "columnText": "机构类型" }, { "columnName": "ORGNA_ADDRESS", "columnText": "机构地址" }, { "columnName": "ORGNA_TEL", "columnText": "联系电话"}];
                queryBuilder = [{ "name": "id", "value": treeNode.id}];
                initNewGrid(queryBuilder, ashxParam, columnInfo, addPage, editPage, detailPage);
                return false;
            }
        };
    </script>
</head>
<body>
    <div class="leftTree">
        <ul id="treeDemo" class="ztree">
        </ul>
    </div>
    <div class="leftTreeContent">
        <div class="leftTreeContentGrid">
            <table class="mainTop">
                <tr>
                    <td width="12">
                        <img src="../Images/tab_03.gif" width="12" height="30" alt="" />
                    </td>
                    <td width="16">
                        <img src="../Images/tb.gif" width="16" height="16" alt="" />
                    </td>
                    <td class="tableName">
                        应用组织机构管理
                    </td>
                    <td width="600">
                    </td>
                    <td>
                        <span class="pointer" id="imgCreate" runat="server">
                            <img src="../Images/add.gif" width="14" height="14" alt="" />新增</span>
                    </td>
                    <td>
                        <span class="pointer" id="imgUpdate" runat="server">
                            <img src="../Images/edit.gif" width="14" height="14" alt="" />修改</span>
                    </td>
                    <td>
                        <span class="pointer" id="imgDelete" runat="server">
                            <img src="../Images/del.gif" width="14" height="14" alt="" />删除</span>
                    </td>
                    <td width="12">
                        <img src="../Images/tab_07.gif" width="12" height="30" alt="" />
                    </td>
                </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin: 0 auto;
                table-layout: fixed;">
                <tr>
                    <td width="8" style="background-image: url(../Images/tab_12.gif)">
                        &nbsp;
                    </td>
                    <td>
                        <table id="contentTable" width="100%" border="0" cellpadding="0" cellspacing="1"
                            bgcolor="b5d6e6" onmouseover="changeto()" onmouseout="changeback()">
                        </table>
                    </td>
                    <td width="8" style="background-image: url(../Images/tab_15.gif)">
                        &nbsp;
                    </td>
                </tr>
            </table>
            <div id="pagerDiv" class="pagerDiv">
                <div id="leftImgDiv" class="leftImgDiv">
                    <img src="../Images/tab_18.gif" width="12" height="35" alt="" /></div>
                <div id="pageCountDiv" class="pageCountDiv">
                    共 <span id="totalCountSpan">120</span> 条记录，当前第 <span id="pageIndexSpan">1/10 页</span>页</div>
                <div id="pagerButtonDiv" class="pagerButtonDiv">
                    <a id="firstBut">
                        <img src="../Images/first.gif" width="37" height="15" alt="" /></a> <a id="previousBut">
                            <img src="../Images/back.gif" width="43" height="15" alt="" /></a> <a id="nextBut">
                                <img src="../Images/next.gif" width="43" height="15" alt="" /></a> <a id="lastBut">
                                    <img src="../Images/last.gif" width="37" height="15" alt="" /></a>
                </div>
                <div class="goToDiv">
                    转到第&nbsp;<input type="text" size="4" id="pagerInput" />&nbsp;页
                </div>
                <div id="goToButtonDiv" class="goToButtonDiv">
                    <a id="gotoBut">
                        <img src="../Images/go.gif" width="37" height="15" alt="" /></a>
                </div>
                <div id="rightImgDiv" class="rightImgDiv">
                    <img src="../Images/tab_20.gif" width="16" height="35" alt="" />
                </div>
            </div>
        </div>
    </div>
</body>
</html>
